<tbody>
<tr class="training">
    <td colspan="17" class="training">
        <ul>
            <p class="title"><?php echo lang('label_season');?></p>
            <a href="<?php echo site_url('manager/training/add_season');?>">
                <img src="<?php echo img_module('add_season.png');?>"> <?php echo lang('label_add_season');?>
            </a>
            <?php foreach ($seasons as $value): ?>
            <?php
            $selected_season = NULL;
            if($season == $value->season)
                $selected_season = 'style="background-color: black"';
            ?>
            <li <?php echo $selected_season;?>>
                <a href="<?php echo site_url('manager/training/'.$value->season.'/'.$edit_view);?>"><?php echo $value->season;?></a>
            </li>
            <?php endforeach; ?>
        </ul>
    </td>
</tr>

<tr>
    <td><p class="text_high"><?php echo lang('label_match_round');?></p></td>
    <?php
    for ($match_round = 0; $match_round <= 15; ++$match_round):?>
        <?php $ht_match_round = $match_round + 1;?>
        <td <?php echo get_bg_color($season, $ht_match_round);?>>
            <p class="text_high"><?php echo $match_round + 1;?></p>
        </td>
        <?php endfor; ?>
</tr>

<tr>
    <td><p class="text_high"><?php echo lang('label_training');?></p></td>
    <?php
    for ($match_round = 0; $match_round <= 15; ++$match_round) {
        $ht_match_round = $match_round+1;
        $training_teams = new Training_team();
        $where = array(
            'team_id' => get_team_id(),
            'season' => $season
        );
        $training_trained = $training_teams->where($where)->get();
        $training_type = explode('-', $training_trained->training_type);
        $training_level = explode('-', $training_trained->training_level);
        $stamina_training_part = explode('-', $training_trained->stamina_training_part);
        ?>
        <td <?php echo get_bg_color($season, $ht_match_round);?>>
        <?php if ($edit_view):?>
        <select name="<?php echo 'training_type-'.$match_round;?>">
            <?php foreach ($training_types as $value): ?>
            <option value="<?php echo $value->id ?>" <?php if ($value->id == $training_type[$match_round]) echo 'selected' ?>>
                <p class="text_high"><?php echo lang('training_type_'.$value->id);?></p>
            </option>
            <?php endforeach;?>
        </select>
        <?php else:?>
            <?php foreach ($training_types as $value):?>
                <?php if ($value->id == $training_type[$match_round]):?>
                    <p class="text_high"><?php echo lang('training_type_'.$value->id);?></p>
                    <?php endif;?>
                <?php endforeach;?>
            <?php endif;?>
    </td>
    <?php }?>
</tr>

<tr>
    <td><p class="text_high"><?php echo lang('label_stamina');?></p></td>
    <?php
    for ($match_round = 0; $match_round <= 15; ++$match_round) {
        $ht_match_round = $match_round+1;
    ?>
    <td <?php echo get_bg_color($season, $ht_match_round);?>>
        <?php if ($edit_view):?>
        <input type="number" min="0" max="100" step="1" name="<?php echo 'stamina_training_part-'.$match_round;?>" value="<?php echo $stamina_training_part[$match_round];?>" class="training" > %
        <?php else:?>
        <p class="text_high"><?php echo $stamina_training_part[$match_round];?>%</p>
        <?php endif;?>
    </td>
    <?php } ?>
</tr>
</tbody>